using System;
using NHibernate;

namespace Genrsis.Data.NHibernate
{
    public class NHibernateRepository<T> : IRepository<T>
    {
        private readonly ISession _session;

        public NHibernateRepository(ISession session)
        {
            _session = session;
        }

        public T Get(int id)
        {
            return _session.Get<T>(id);
        }

        public void Add(T item)
        {
            _session.SaveOrUpdate(item);
        }
    }
}